<?php 
if (isset($_POST['submit']))
{
	
	$pseudo = $_POST['pseudo'];
	$email = $_POST['email'];
	$password = $_POST['password'];
	$r_password =$_POST['repeat_password'];
	$website = $_POST['site_web'];
	
	$ip = $_SERVER['REMOTE_ADDR'];

	if($pseudo != "")
	{
		if($password !="")
		{
			if($password == $r_password)
			{
				if($email != "")
				{
					if(VerifierAdresseMail($email))
					{
						$connexion =  sql_connecter();
						$requete = "INSERT INTO users VALUES ";	
						$requete.= "('', 12, '$pseudo', '$email', '$password', 'now', '', '$website', '$ip')";
						$resultat = sql_executer($connexion, $requete);
						
						if($resultat)
						{
							$_SESSION['email'] = $email;
							printf("Votre compte a bien été créé, vous pouvez dés à présent participer sur le site en vous connectant.");
						}
						
					}
					else
					printf("L'adresse email n'est pas valide !");
				}	
				else
				printf("Vous n'avez pas rentré d'adresse email !");
			}
			else
			printf("Les mots de passe sont diffèrents !");
		}
		else
		printf("Vous n'avez pas rentré de mot de passe !");
	}
	else 
	printf("Vous n'avez pas rentré de pseudo !");
}
else 
{

?>
<!-- 
			<td>
			<div class="error-left"></div>
			<div class="error-inner">This field is required.</div>
			</td>
 -->

<div id="page-heading"><h1>Inscription</h1></div>


<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
<tr>
	<th rowspan="3" class="sized"><img src="images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
	<th class="topleft"></th>
	<td id="tbl-border-top">&nbsp;</td>
	<th class="topright"></th>
	<th rowspan="3" class="sized"><img src="images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
</tr>
<tr>
	<td id="tbl-border-left"></td>
	<td>
	<!--  start content-table-inner -->
	<div id="content-table-inner">
	
	<table border="0" width="100%" cellpadding="0" cellspacing="0">
	<tr valign="top">
	<td>

		<!-- start id-form -->
		<form method="post" action="">
		<table border="0" cellpadding="0" cellspacing="0"  id="id-form">
		<tr>
			<th valign="top">Pseudo :</th>
			<td><input type="text" name="pseudo" class="inp-form" /></td>
			<td></td>
		</tr>
		<tr>
			<th valign="top">Email :</th>
			<td><input type="text" name="email" class="inp-form-error" /></td>
		</tr>
		<tr>
			<th valign="top">Password :</th>
			<td><input type="text" name="password" class="inp-form" /></td>
			<td></td>
		</tr>
		<tr>
			<th valign="top">Répéter password :</th>
			<td><input type="text" name="repeat_password" class="inp-form" /></td>
			<td></td>
		</tr> 
		<tr>
			<th valign="top">Site Web:</th>
			<td><input type="text" name="site_web" class="inp-form" /></td>
			<td></td>
		</tr>

	<tr>
		<th>&nbsp;</th>
		<td valign="top">
			<input type="submit" value="" name="submit" class="form-submit" />
			<input type="reset" value="" class="form-reset" />
		</td>
		<td></td>
	</tr>
	</table>
	</form>
	<!-- end id-form  -->

	</td>
	<td>

	<!--  start related-activities -->
	<div id="related-activities">
		
		<!--  start related-act-top -->
		<div id="related-act-top">
		<img src="images/forms/header_related_act.gif" width="271" height="43" alt="" />
		</div>
		<!-- end related-act-top -->
		
		<!--  start related-act-bottom -->
		<div id="related-act-bottom">
		
			<!--  start related-act-inner -->
			<div id="related-act-inner">
			
				<div class="left"><a href=""><img src="images/forms/icon_plus.gif" width="21" height="21" alt="" /></a></div>
				<div class="right">
					<h5>Add another product</h5>
					Lorem ipsum dolor sit amet consectetur
					adipisicing elitsed do eiusmod tempor.
					<ul class="greyarrow">
						<li><a href="">Click here to visit</a></li> 
						<li><a href="">Click here to visit</a> </li>
					</ul>
				</div>
				
				<div class="clear"></div>
				<div class="lines-dotted-short"></div>
				
				<div class="left"><a href=""><img src="images/forms/icon_minus.gif" width="21" height="21" alt="" /></a></div>
				<div class="right">
					<h5>Delete products</h5>
					Lorem ipsum dolor sit amet consectetur
					adipisicing elitsed do eiusmod tempor.
					<ul class="greyarrow">
						<li><a href="">Click here to visit</a></li> 
						<li><a href="">Click here to visit</a> </li>
					</ul>
				</div>
				
				<div class="clear"></div>
				<div class="lines-dotted-short"></div>
				
				<div class="left"><a href=""><img src="images/forms/icon_edit.gif" width="21" height="21" alt="" /></a></div>
				<div class="right">
					<h5>Edit categories</h5>
					Lorem ipsum dolor sit amet consectetur
					adipisicing elitsed do eiusmod tempor.
					<ul class="greyarrow">
						<li><a href="">Click here to visit</a></li> 
						<li><a href="">Click here to visit</a> </li>
					</ul>
				</div>
				<div class="clear"></div>
				
			</div>
			<!-- end related-act-inner -->
			<div class="clear"></div>
		
		</div>
		<!-- end related-act-bottom -->
	
	</div>
	<!-- end related-activities -->

</td>
</tr>
<tr>
<td><img src="images/shared/blank.gif" width="695" height="1" alt="blank" /></td>
<td></td>
</tr>
</table>
 
<div class="clear"></div>
 

</div>
<!--  end content-table-inner  -->
</td>
<td id="tbl-border-right"></td>
</tr>
<tr>
	<th class="sized bottomleft"></th>
	<td id="tbl-border-bottom">&nbsp;</td>
	<th class="sized bottomright"></th>
</tr>
</table>


<div class="clear">&nbsp;</div>
<?php } ?>
